package org.cloudnote.service;

import org.cloudnote.bean.*;
import org.cloudnote.util.NoteUtil;
import org.cloudnote.util.SpringTest;
import org.junit.Test;

import java.util.List;

public class ServiceTest extends SpringTest {

    @Test
    public void testlogin(){
       UserService userService = super.getContext().getBean("userServiceImpl", UserService.class);
        NoteResult result = userService.login("zhou", "123");
        System.out.println(result);
    }
    @Test
    public void testregister(){
        User user = new User();

        UserService userService = super.getContext().getBean("userServiceImpl", UserService.class);
        NoteResult result = userService.register(user);
        System.out.println(result.getStatus());
        System.out.println(result.getData());
    }
    @Test
    public void testGetById(){

        NoteBookService notebookService = super.getContext().getBean("noteBookServiceImpl", NoteBookService.class);
        List<NoteBook> noteBooks = notebookService.getByUserId("39295a3d-cc9b-42b4-b206-a2e7fab7e77c");
        for (NoteBook noteBook : noteBooks) {
            System.out.println(noteBook);
        }
    }
    @Test
    public void testgetByNoteId(){
        NoteService noteService = super.getContext().getBean("noteServiceImpl", NoteService.class);
        Note note = noteService.getByNoteId("09f60aeb-a573-4fcf-b39f-903e1536e762");
        System.out.println(note);
    }
    @Test
    public void testShareAdd(){
        NoteService noteService = super.getContext().getBean("noteServiceImpl", NoteService.class);
        Share share = noteService.getShareByNoteId("09f60aeb-a573-4fcf-b39f-903e1536e762");
        System.out.println(share);

    }
}
